def print_string_indices(s):
    length = len(s)

    # 打印正向索引行
    print("正向索引 >>>")
    print(" " + " ".join(str(i) for i in range(length)))

    # 打印字符框
    print("+" + "+".join(["-" * 3] * (length + 1)) + "+")
    print("|" + "|".join(f" {char} " for char in s) + "|")
    print("+" + "+".join(["-" * 3] * (length + 1)) + "+")

    # 打印反向索引行
    reverse_indices = [i - length for i in range(length)]
    reverse_indices_str = " ".join(str(i) for i in reverse_indices)
    print(" " + reverse_indices_str[::-1])
    print("<<< 反向索引")


# 示例字符串
string = "Hello, Python!"
print_string_indices(string)